
package com.candy.candymember.controller;

import com.alibaba.fastjson2.JSONObject;
import com.candy.candycommon.utils.ResultBean;
import com.candy.candylogservice.dto.LogLinkDTO;
import com.candy.candylogservice.service.DubboLogLinkService;
import lombok.extern.slf4j.Slf4j;
//import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author suYanLong
 * @date 2022年09月29日 13:36
 * TODO springCloudAlibaba中使用dubbo协议进行通讯
 */
@Slf4j
@RestController
@RequestMapping("dubbo")
public class DubboMemberController {

//    @DubboReference(check = false)
    DubboLogLinkService dubboLogLinkService;

    //    http://localhost:8087/dubbo/getOrder
    @GetMapping("getOrder")
    public ResultBean getOrder() {
        log.info("=============getOrder============");
        LogLinkDTO logLinkDTO = new LogLinkDTO();
        logLinkDTO.setRequestUrl("https://baidu.com");
        ResultBean save = dubboLogLinkService.save(logLinkDTO);
        log.info("======", JSONObject.toJSONString(save));
        return save;
    }

}
